#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int mat[1505][3005], pr[1505][3005];
int p[1505]; int ret[3005];
int qkpow(int a, int b) {
	int ans = 1; for (; b; b >>= 1, a = 1ll * a * a % mod) if (b & 1) ans = 1ll * ans * a % mod; return ans;
}
int main() {
	freopen("random.in", "r", stdin); freopen("random.out", "w", stdout);
	int n, k, q; scanf("%d %d %d", &n, &k, &q);
	for (int i = 1; i < n; i++) mat[0][i + 1500] = 1;
	int bn = (n - 2) * (n - 2 - 1) / 2;
	for (int _ = 0; _ < k; _++) {
		for (int i = -n + 1; i < n; i++) pr[_][i + 1500] = (pr[_][i - 1 + 1500] + mat[_][i + 1500]) % mod;
		for (int i = -n + 1; i < n; i++) {
			if (i == 0) continue;
			mat[_ + 1][i + 1500] = 1ll * (mod + bn - 2) * mat[_][i + 1500] % mod;
			if (i > 0) {
				mat[_ + 1][i + 1500] = ((unsigned)mat[_ + 1][i + 1500] + pr[_][n + 1499] + mod - pr[_][1499]) % mod;
				mat[_ + 1][i + 1500] = ((unsigned)mat[_ + 1][i + 1500] + pr[_][i + 1500] + mod - pr[_][i - n + 1500]) % mod;
				mat[_ + 1][i + 1500] = (mat[_ + 1][i + 1500] + mat[_][-i + 1500]) % mod;
			}
			else {
				mat[_ + 1][i + 1500] = ((unsigned)mat[_ + 1][i + 1500] + pr[_][1500] + mod - pr[_][-n + 1500]) % mod;
				mat[_ + 1][i + 1500] = ((unsigned)mat[_ + 1][i + 1500] + pr[_][i + n + 1499] + mod - pr[_][i + 1499]) % mod;
				mat[_ + 1][i + 1500] = (mat[_ + 1][i + 1500] + mat[_][-i + 1500]) % mod;
			}
		}
	}
	// for (int _ = 0; _ <= k; _++) {
	// 	for (int i = -n + 1; i < n; i++) printf("%d%c", mat[_][i + 1500], " \n"[i + 1 == n]);
	// }
	for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
	for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) {
		p[i] < p[j] ? ret[i - j + 1500]++ : ret[j - i + 1500]++;
	}
	const auto calc = [&](int K) {
		int ans = 0;
		for (int i = -n + 1; i < n; i++) ans = (ans + 1ll * mat[K][i + 1500] * ret[i + 1500]) % mod;
		printf("%lld\n", 1ll * ans * qkpow(1ll * n * (n - 1) / 2 % mod, (2 * mod - 2 - K) % (mod - 1)) % mod);
	};
	calc(k);
	for (int i = 1; i <= q; i++) {
		int u, v; scanf("%d %d", &u, &v);
		for (int j = 1; j <= n; j++) if (j != u && j != v) {
			p[u] < p[j] ? ret[u - j + 1500]-- : ret[j - u + 1500]--;
			p[v] < p[j] ? ret[v - j + 1500]-- : ret[j - v + 1500]--;
		}
		p[u] < p[v] ? ret[u - v + 1500]-- : ret[v - u + 1500]--;
		swap(p[u], p[v]);
		for (int j = 1; j <= n; j++) if (j != u && j != v) {
			p[u] < p[j] ? ret[u - j + 1500]++ : ret[j - u + 1500]++;
			p[v] < p[j] ? ret[v - j + 1500]++ : ret[j - v + 1500]++;
		}
		p[u] < p[v] ? ret[u - v + 1500]++ : ret[v - u + 1500]++;
		calc(k - i);
	}
}
/*
run random < random1.in > random1.out
run random < random2.in > random2.out
run random < random3.in > random3.out
run random < random4.in > random4.out
diff random1.out random1.ans -Z
diff random2.out random2.ans -Z
diff random3.out random3.ans -Z
diff random4.out random4.ans -Z
*/